]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Ignore dragging over leeways
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Mon, 25 May 2020 19:00:23 +0000 (16:00 -0300)
committerFlorian Müllner <florian.muellner@gmail.com>
Mon, 20 Jul 2020 16:13:19 +0000 (16:13 +0000)
The leeways are parts of the icon that ignore incoming drag
events. This is how IconGrid and IconGridLayout treat it, and
this is how the icons should treat themselves too.

Make AppIcon ignore dragging over the left and right leeways.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284

js/ui/appDisplay.js

index eadbe9bb4c378e2d351f1f9e369d9e755045b271..6ae3f0eb5a3f544462334fac6c6640c699ce15fb 100644 (file)
@@ -2212,24 +2212,37 @@ var AppIcon = GObject.registerClass({
         return DND.DragMotionResult.CONTINUE;
     }
 
-    handleDragOver(source) {
+    _withinLeeways(x) {
+        return x < IconGrid.LEFT_DIVIDER_LEEWAY ||
+            x > this.width - IconGrid.RIGHT_DIVIDER_LEEWAY;
+    }
+
+    handleDragOver(source, _actor, x) {
         if (source == this)
             return DND.DragMotionResult.NO_DROP;
 
         if (!this._canAccept(source))
             return DND.DragMotionResult.CONTINUE;
 
+        if (this._withinLeeways(x)) {
+            this._setHoveringByDnd(false);
+            return DND.DragMotionResult.CONTINUE;
+        }
+
         this._setHoveringByDnd(true);
 
         return DND.DragMotionResult.MOVE_DROP;
     }
 
-    acceptDrop(source) {
+    acceptDrop(source, _actor, x) {
         this._setHoveringByDnd(false);
 
         if (!this._canAccept(source))
             return false;
 
+        if (this._withinLeeways(x))
+            return false;
+
         let view = _getViewFromIcon(this);
         let apps = [this.id, source.id];